function useScores() {
    const [scores, setScores] = React.useState({ daily: [], historical: [] });
    const [isLeaderboardLoading, setIsLeaderboardLoading] = React.useState(true);
    const [initialLoadComplete, setInitialLoadComplete] = React.useState(false);

    const loadScores = async () => {
        try {
            setIsLeaderboardLoading(true);
            const [dailyScores, historicalScores] = await Promise.all([
                getLeaderboard('daily'),
                getLeaderboard('historical')
            ]);

            setScores({
                daily: dailyScores,
                historical: historicalScores
            });
            setInitialLoadComplete(true);
        } catch (error) {
            reportError(error);
            console.error('Failed to load scores:', error);
        } finally {
            setIsLeaderboardLoading(false);
        }
    };

    React.useEffect(() => {
        loadScores();
    }, []);

    const handleScoreUpdate = async (playerName, level, currentScores) => {
        try {
            const updatedScores = await updateLeaderboard(playerName, level, currentScores);
            setScores(updatedScores);
        } catch (error) {
            reportError(error);
            console.error('Failed to update score:', error);
        }
    };

    return {
        scores,
        isLeaderboardLoading,
        initialLoadComplete,
        loadScores,
        handleScoreUpdate
    };
}
